﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true"
    CodeBehind="MessageSettings.aspx.cs" Inherits="SharingCenter.Web.Admin.MessageSettings" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitlePlaceHolder" runat="server">
    邮件模板设置
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script src="scripts/MessageSettings.js" type="text/javascript"></script>
    <h2 class="bb">
        邮件模板设置</h2>
    <div class="fc">
        <div class="left ctn-p-r" style="width:150px">
            <h3>
                选择邮件模板</h3>
            <asp:ListView runat="server" ID="lvMailEventGroup" DataSourceID="XmlDataSource1">
                <LayoutTemplate>
                    <dl>
                        <dt>
                            <dt id="itemPlaceholder" runat="server"></dt>
                        </dt>
                    </dl>
                </LayoutTemplate>
                <ItemTemplate>
                    <dt>
                        <asp:Label ID="Label1" runat="server" Text='<%# XPath("@EventGroupDesc") %>'></asp:Label>
                        <asp:ListView runat="server" ID="lvMailEvent" DataSource='<%# XPathSelect("Event") %>'>
                            <LayoutTemplate>
                                <dd runat="server" id="itemPlaceholder" />
                            </LayoutTemplate>
                            <ItemTemplate>
                                <dd>
                                    <asp:LinkButton rel="eventlink" ID="btnEventName" runat="server" Text='<%#XPath("@EventDesc") %>'
                                        CommandArgument='<%#XPath("../@EventGroupName")+"|"+XPath("@EventName")+"|"+XPath("@EventDesc") %>'
                                        OnCommand="btnEventName_Command" OnLoad="btnEventName_Load" /></dd>
                            </ItemTemplate>
                        </asp:ListView>
                    </dt>
                </ItemTemplate>
            </asp:ListView>
        </div>
        <div class="left mailcont">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
       <ContentTemplate>
        <asp:Panel runat="server" ID="pnForm" CssClass="left ctn3" Visible="false">
            <h3>
                <asp:Label ID="lblEventDesc" runat="server"></asp:Label></h3>
            
               
           
            <asp:FormView ID="FormView1" runat="server" DataKeyNames="MailTemplateId" DataSourceID="LinqDataSource1">
                <EditItemTemplate>
                    <div class="ctn-p-b">
                        邮件标题:
                    </div>
                    <div class="ctn-p-b">
                        <asp:TextBox ID="MailSubjectTextBox" runat="server" CssClass="tb-l" Text='<%# Bind("MailSubject") %>' />
                    </div>
                    <div class="ctn-p-b">
                        邮件正文:
                    </div>
                    <div class="ctn-p-b">
                        <asp:TextBox ID="MailContentTextBox" CssClass="tb-l"  TextMode="MultiLine" Rows="10" runat="server"
                            Text='<%# Bind("MailContent") %>' />
                    </div>
                    <div class="ctn-p-b">
                        <asp:CheckBox ID="EnabledCheckBox" runat="server" Checked='<%# Bind("Enabled") %>'  Text="是否生效？"/>
                    </div>
                    <div class="actionarea">
                    <asp:LinkButton ID="UpdateButton" CssClass="submitbutton" runat="server" CausesValidation="True" CommandName="Update"
                        Text="修改" />
                        </div>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <div class="ctn-p-b">
                        邮件标题:
                    </div>
                    <div class="ctn-p-b">
                        <asp:TextBox ID="MailSubjectTextBox" runat="server" CssClass="tb-l"  Text='<%# Bind("MailSubject") %>' />
                    </div>
                    <div class="ctn-p-b">
                        邮件正文:
                    </div>
                    <div class="ctn-p-b">
                        <asp:TextBox ID="MailContentTextBox" TextMode="MultiLine" Rows="10" CssClass="tb-l"  runat="server"
                            Text='<%# Bind("MailContent") %>' />
                    </div>
                    <div class="ctn-p-b">
                        
                        <asp:CheckBox ID="EnabledCheckBox" runat="server" Checked='<%# Bind("Enabled") %>' Text="是否生效？" />
                    </div>
                    <div class="actionarea">
                        <asp:LinkButton ID="InsertButton" CssClass="submitbutton" runat="server" CausesValidation="True"
                            CommandName="Insert" Text="确定" />
                    </div>
                </InsertItemTemplate>
            </asp:FormView>
            <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="SharingCenter.Web.Classes.scDataContext"
                EnableInsert="True" EnableUpdate="True" TableName="Sc_MailTemplates"
                Where="MailEventGroup == @MailEventGroup &amp;&amp; MailEventName == @MailEventName">
                <WhereParameters>
                    <asp:Parameter Name="MailEventGroup" Type="String" />
                    <asp:Parameter Name="MailEventName" Type="String" />
                </WhereParameters>
            </asp:LinqDataSource>
        </asp:Panel>
        <asp:Panel runat="server" ID="pnParam" CssClass="left ctn3 paramlist" Visible="false" style="width:300px">
               <h3>参数列表</h3>
            <asp:ListView runat="server" ID="lvMailParam">
                <LayoutTemplate>
                    <table cellpadding="2">
                        <tr runat="server" id="itemPlaceholder" />
                    </table>
                </LayoutTemplate>
                <ItemTemplate>
                    <tr>
                        <td>
                        <%--<asp:HyperLink ID="lnkParam" runat="server" Text='<%#XPath("@ParamName") %>' NavigateUrl="javascript:" />--%>
                            <asp:TextBox ID="TextBox1" runat="server" style="width:160px" Text='<%#Eval("ParamName", "${0}$") %>' ReadOnly="true"></asp:TextBox>
                        </td>
                        <td>
                            <asp:Label ID="Label2" runat="server" Text='<%#Eval("ParamDesc") %>'></asp:Label>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:ListView>
            <myuc:MessageBox ID="MessageBox1" runat="server" Text="将上方的参数复制到标题或正文中，系统将会自动替换成相应的内容。" MessageType="Generic" />
            
        </asp:Panel>
        </ContentTemplate>
         </asp:UpdatePanel>
          </div>
    </div>
    <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/App_Data/MessageReplacementKey.xml"
        XPath="//EventGroup"></asp:XmlDataSource>
</asp:Content>
